﻿@model IList
@using (Html.BeginForm())
{
    @Html.DevExpress().GridView(
    settings =>
    {
        settings.Name = "gridView";
        DevControlHelper.InitDefaultPagerGridViewSettings(settings);
        settings.SettingsPager.Mode = GridViewPagerMode.ShowAllRecords;
        settings.EnableAlternatingRowColor();
        settings.EnableRowIndexColumn();
        var deptcol = settings.Columns.Add("deptname", "单位");
        deptcol.CellStyle.Wrap = DefaultBoolean.False;
        deptcol.Width = Unit.Pixel(200);
        deptcol.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
        settings.Columns.Add("CAR_RECORD", "车辆牌照").HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
        settings.Columns.Add("IS_GPS", "是否安装GPS").HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
        settings.AddLeaderCarStatusColumn("STATUS", "使用情况");
        //settings.Columns.Add("STATUS", "使用情况").HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
        settings.Columns.Add("NOTE", "说明事项").HeaderStyle.HorizontalAlign = HorizontalAlign.Left;
        settings.Columns.Add(col =>
        {
            col.CellStyle.Paddings.Padding = 1;
            col.CellStyle.Paddings.PaddingLeft = 5;
            col.Caption = "";
            col.Width = 100;
            col.CellStyle.HorizontalAlign = HorizontalAlign.Center;

            col.SetDataItemTemplateContent(c =>
            {
                string id = DataBinder.Eval(c.DataItem, "ID").ToString();
                ViewContext.Writer.Write(
                Html.ActionLink("[编辑]", "", null, new { href = "javascript:edit('" + id + "');" })+"&nbsp;"+
                Html.ActionLink("[删除]", "LeaderCarDelete", new { id = id }, new { onclick = "return confirm('是否要删除此记录?')" })
                );
                
            });
        });
    }).Bind(Model).GetHtml()
}